<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Đặng Khánh Trung
 * Date: 11/6/12
 * Time: 7:02 PM
 * To change this template use File | Settings | File Templates.
 */
// no direct access
defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('behavior.mootools');

JLoader::register('MucChon', JPATH_COMPONENT . '/helpers/mucchon.php');

$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_vast/assets/css/admin_ui.css');
$document->addStyleSheet(JURI::base() . 'components/com_vast/assets/css/admin_menu.css');
$document->addStyleSheet(JURI::base() . 'components/com_vast/assets/css/admin.styles.css');
$document->addStyleSheet(JURI::base() . 'components/com_vast/assets/css/toolbar_images.css');
$document->addStyleSheet(JURI::base() . 'components/com_vast/assets/css/menu_images.css');

$document->addStyleSheet(JURI::root() . 'components/com_vast/assets/css/chosen.css');
$document->addStyleSheet(JURI::root() . 'components/com_vast/assets/css/vtip.css');
$document->addStyleSheet(JURI::root() . 'components/com_vast/assets/js/fancybox/jquery.fancybox-1.3.4.css');

$document->addScript(JURI::root() . 'components/com_vast/assets/js/jquery.min.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/jquery-ui.min.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/jquery.ui.autocomplete.html.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/jquery.noConflict.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/vmsite.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/fancybox/jquery.mousewheel-3.0.4.pack.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/fancybox/jquery.easing-1.3.pack.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js');
$document->addScript(JURI::base() . 'components/com_vast/assets/js/jquery.coookie.js');
$document->addScript(JURI::root() . 'components/com_vast/assets/js/chosen.jquery.min.js');
$document->addScript(JURI::base() . 'components/com_vast/assets/js/vm2admin.js');

$document->addScriptDeclaration('
		var tip_image=\'/joomla/components/com_virtuemart/assets/js/images/vtip_arrow.png\';
		var vm2string ={ editImage: \'edit image\',select_all_text: \'select all options\',select_some_options_text :\'Select some Options\', select_an_option_text:\'Select an Option\'} ;
		 jQuery( function($) {

			$(\'dl#system-message\').hide().slideDown(400);
			$(\'.virtuemart-admin-area .toggler\').vm2admin(\'toggle\');
			$(\'#admin-ui-menu\').vm2admin(\'accordeon\');
			if ( $(\'#admin-ui-tabs\').length  ) {
				$(\'#admin-ui-tabs\').vm2admin(\'tabs\',virtuemartcookie).find(\'select\').chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text});
			}

			$(\'#content-box [title]\').vm2admin(\'tips\',tip_image);
			$(\'.modal\').fancybox();
			$(\'.reset-value\').click( function(e){
                e.preventDefault();
                none = \'\';
                jQuery(this).parent().find(\'.ui-autocomplete-input\').val(none);

            });

		});

		var virtuemartcookie="virtuemart";

');

$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'a.ordering';
?>

<div class="virtuemart-admin-area">
    <?php 
        $mucchon = new MucChon();
        echo $mucchon->layMucChon();
    ?>

<div id="admin-content-wrapper">
    <div class="toggler vmicon-show"></div>
    <div id="admin-content" class="admin-content">

        <form action="<?php echo JRoute::_('index.php?option=com_vast&view=tinhtranglamviecs');?>" method="post"
              name="adminForm" id="adminForm">
            <div id="header">
                <div id="filterbox">
                    <table class="">
                        <tr>
                            <td align="left">
                                <?php echo JText::_('COM_VAST_TINHTRANGLAMVIEC_FILTER_MOTA_LABEL'); ?>
                                <input type="text" name="filter_search" id="filter_search"
                                       value="<?php echo $this->escape($this->state->get('filter.search')); ?>"
                                       class="text_area"/>
                                <button
                                    onclick="this.form.submit();"><?php echo JText::_('COM_VAST_FIND_LABEL'); ?></button>
                                <button
                                    onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo JText::_('COM_VAST_RESET_LABEL'); ?></button>
                            </td>

                        </tr>
                    </table>
                </div>
                <div id="resultscounter">
                    <?php if ($this->pagination->total > 0): ?>
                    <?php echo JText::_('COM_VAST_RESULT_LABEL'); ?>
                    <?php echo ($this->pagination->limitstart + 1); ?>
                    - <?php echo ($this->pagination->limitstart + $this->pagination->limit < $this->pagination->total ? $this->pagination->limitstart + $this->pagination->limit : $this->pagination->total); ?>
                    trong số <?php echo $this->pagination->total; ?></div>
                    <?php endif; ?>
            </div>
            <table class="adminlist">
                <thead>
                <tr>
                    <th width="1%">
                        <input type="checkbox" name="checkall-toggle" value=""
                               title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>"
                               onclick="Joomla.checkAll(this)"/>
                    </th>
                    <th>
                        <?php echo JHtml::_('grid.sort', 'Mô tả', 'a.mota', $listDirn, $listOrder); ?>
                    </th>
                    <th width="1%" class="nowrap">
                        <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
                    </th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <td colspan="3">
                        <?php echo $this->pagination->getListFooter(); ?>
                    </td>
                </tr>
                </tfoot>
                <tbody>

                <?php foreach ($this->items as $i => $item) :
                    $canEdit = $user->authorise('core.manage', 'com_vast') || $user->authorise('vast.danhmuc.manage', 'com_vast');
                    ?>

                <tr class="row<?php echo $i % 2; ?>">
                    <td class="center">
                        <?php echo JHtml::_('grid.id', $i, $item->id); ?>
                    </td>
                    <td>
                        <?php if ($canEdit): ?>
                        <a href="<?php echo JRoute::_('index.php?option=com_vast&task=tinhtranglamviec.edit&id=' . $item->id);?>">
                            <?php echo $this->escape($item->mota); ?></a>
                        <?php else : ?>
                        <?php echo $this->escape($item->mota); ?>
                        <?php endif; ?>
                    </td>
                    <td class="center">
                        <?php echo (int)$item->id; ?>
                    </td>
                </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>

            <?php //Load the batch processing form. ?>

            <div>
                <input type="hidden" name="task" value=""/>
                <input type="hidden" name="boxchecked" value="0"/>
                <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>"/>
                <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>"/>
                <?php echo JHtml::_('form.token'); ?>
            </div>
        </form>
    </div>
</div>
</div>